package com.cangmaomao.m_penManage.adapter

import android.support.v4.widget.ContentLoadingProgressBar
import android.text.TextUtils
import android.view.View
import android.widget.TextView
import com.cangmaomao.m_penManage.R
import com.cangmaomao.m_penManage.bean.BleDeviceData
import com.cangmaomao.recyclerview.adapter.CMMAdapter
import com.cangmaomao.recyclerview.adapter.CMMViewHolder

/**
 * Created by Administrator on 2018/7/15 0015.
 */

class NearbyAdapter(layoutId: Int = R.layout.item_oper_pen) : CMMAdapter<BleDeviceData>(layoutId) {


    override fun convert(holder: CMMViewHolder, bleDevice: BleDeviceData, p2: Int) {
        holder.setText(R.id.tv_open_author, if (TextUtils.isEmpty(bleDevice.bleDevice.name)) "未知蓝牙" else bleDevice.bleDevice.name)
        holder.getView<TextView>(R.id.tv_not).visibility = if (bleDevice.isFlag) View.GONE else View.VISIBLE
        holder.getView<ContentLoadingProgressBar>(R.id.progressBar).visibility = if (!bleDevice.isFlag) View.GONE else View.VISIBLE
    }

}
